<?php
    require('init.php');
    require('header.php');
    
    $marques = Marque::getMarques();
    echo '<div id="gestion"  class= "container_12">';
    echo '<a class="grid_4 alpha" href="details_marques.php">
    .     <img alt="#" src="../img/ajouter.png" title="Ajouter" class="btn_ajouter" width="30"/>
          Ajouter une nouvelle marque</a>';
    echo '</div>';
    echo    '<div class= "container_12">';
    echo    '<table class="grid_12" cellspacing="0">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Libelle</th>
                        <th>Email</th>
                        <th>Téléphone</th>
                        <th>Logo</th>
                        <th>Date d\'ajout</th>
                        <th>Date de modification</th>
                        <th>Gestion</th>
                    </tr>
                </thead>
                <tbody>';
    
    foreach($marques as $marque) {
        echo        '<tr>
                        <td>
                            '.$marque->getId().'
                        </td>
                        <td>
                            '.$marque->getLibelle().'
                        </td>
                        <td>
                            '.$marque->getEmail().'
                        </td>
                        <td>
                            '.$marque->getTel().'
                        </td>
                        <td>
                            <img alt="Logo" src="../img/m/'.$marque->getImage().'" title="" width="80px" height="50px">
                        </td>
                        <td>
                            '.$marque->getDateAjout('d/m/Y H:i:s').'
                        </td>
                        <td>
                            '.$marque->getDateModif('d/m/Y H:i:s').'
                        </td>
                        <td>
                            <a href="details_marques.php?id='.$marque->getId().'">Gérer</a> 
                        </td>
                    </tr>';
    }
    echo        '</tbody>
            </table>
             </div>';
?>